package com.hst.capacity.domain.repository.redis;

import org.springframework.data.geo.GeoResults;
import org.springframework.data.redis.connection.RedisGeoCommands;

public interface DriverLocationRedis {

    String KEY_PREFIX_IN_SERVICE = "DRIVER:IN-SERVICE:";

    String KEY_PREFIX_LOCATION = "DRIVER:LOCATION:";

    String KEY_EXPRESS_SUFFIX = "DRIVER:LOCATION:Express:";

    String KEY_EXPRESS_PREFIX_IN_SERVICE = "DRIVER:IN-SERVICE:Express";

    /**
     * @param keySuffix Redis Key 后缀
     * @param driverId 司机唯一ID
     * @param lon 经度
     * @param lat 纬度
     *
     * */
    void  writeDriverLocation (String keySuffix, String driverId, double lon, double lat);

    GeoResults<RedisGeoCommands.GeoLocation<String>> readDriverLocations(String keySuffix, double lon, double lat , double range);

    void clearDriverLocations(String keySuffix, String driverId);
    

    void clearExpressDriverServiceState(String keySuffix, String driverId);

    /** 快车定位写入 */
    void writeExpressDriverLocation(String region_code,  String driverId, double lon, double lat);

    /** 快车定位读取 */
    GeoResults<RedisGeoCommands.GeoLocation<String>> readExpressDriverLocations(String region_code, double lon, double lat, double range);

    /** 快车定位清除 */
    void clearExpressDriverLocations(String region_code, String driverId);

}
